Code
if(base::interactive()) {
params <- rmarkdown::yaml_front_matter(here::here("analysis/03_beta_diversity.qmd"))$params
}
factor_of_interest <- params$factor_of_interestWhere we analyse the effect of a factor on shared diversity
Date: December 2, 2024
See the documentation of the MiscMetabar package for example of btea diversity analysis.
if(base::interactive()) {
params <- rmarkdown::yaml_front_matter(here::here("analysis/03_beta_diversity.qmd"))$params
}
factor_of_interest <- params$factor_of_interestlibrary(knitr)
library(targets)
library(MiscMetabar)
here::i_am("analysis/03_beta_diversity.qmd")
source(here::here("R/styles.R"))d_pq <- clean_pq(tar_read("d_vs", store=here::here("_targets/")))Cleaning suppress 0 taxa and 26 samples.
formattable_pq(
subset_samples(d_pq, Type %in% c("Mix", "Mono")),
factor_of_interest,
min_nb_seq_taxa = 1000,
lev_col_taxa = "Family",
taxonomic_levels=c("Order", "Family", "Genus"),
log10trans = TRUE,
)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
library("vegan")Le chargement a nécessité le package : permute
Le chargement a nécessité le package : lattice
This is vegan 2.6-8
plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), "matrix"),
method = "robust.aitchison"
)), color = factor_of_interest) +
geom_point(size = 3) +
stat_ellipse(inherit.aes = F, aes(x = DCA1, y = DCA2, linetype = .data[[factor_of_interest]], col = .data[[factor_of_interest]])) + theme_idest() + scale_color_manual(values=idest_pal$dark_color_idest[[1]][c(5,4,2)])Warning in plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), :
`Ordination species/OTU/taxa coordinate indices did not match `physeq` index
names. Setting corresponding coordinates to NULL.
Warning in plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), :
Color variable was not found in the available data you provided.No color
mapped.
Error in `stat_ellipse()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 3rd layer.
Caused by error in `.data[["Type"]]`:
! Column `Type` not found in `.data`.
adonis_pq(subset_samples(d_pq, Type %in% c("Mix", "Mono")), factor_of_interest, na_remove = TRUE, correction_for_sample_size = TRUE, by = "terms")Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
d_pq |>
subset_samples(Type %in% c("Mix", "Mono")) |>
biplot_pq(merge_sample_by = factor_of_interest, rarefy_after_merging = T)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
res_var <- var_par_rarperm_pq(
subset_samples(d_pq, Type %in% c("Mix", "Mono")),
list_component = list(
"Tmt" = c("Tmt"),
"Bloc" = c("Bloc"),
"Type" = c("Type")
),
nperm = 9,
dbrda_computation = TRUE
)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
plot_var_part_pq(res_var)Error: objet 'res_var' introuvable
Session information are detailed below. More information about the machine, the system, as well as python and R packages, are available in the file data_final/information_run.txt .
sessionInfo()R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Debian GNU/Linux 12 (bookworm)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Paris
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] vegan_2.6-8 lattice_0.22-6 permute_0.9-7 MiscMetabar_0.10.1
[5] purrr_1.0.2 dplyr_1.1.4 dada2_1.34.0 Rcpp_1.0.13-1
[9] ggplot2_3.5.1 phyloseq_1.50.0 targets_1.9.0 knitr_1.49
loaded via a namespace (and not attached):
[1] bitops_1.0-9 deldir_2.0-4
[3] rlang_1.1.4 magrittr_2.0.3
[5] ade4_1.7-22 matrixStats_1.4.1
[7] compiler_4.4.2 mgcv_1.9-1
[9] png_0.1-8 callr_3.7.6
[11] vctrs_0.6.5 reshape2_1.4.4
[13] stringr_1.5.1 pwalign_1.2.0
[15] pkgconfig_2.0.3 crayon_1.5.3
[17] fastmap_1.2.0 backports_1.5.0
[19] XVector_0.46.0 utf8_1.2.4
[21] Rsamtools_2.22.0 rmarkdown_2.29
[23] UCSC.utils_1.2.0 ps_1.8.1
[25] xfun_0.49 zlibbioc_1.52.0
[27] GenomeInfoDb_1.42.1 jsonlite_1.8.9
[29] biomformat_1.34.0 rhdf5filters_1.18.0
[31] DelayedArray_0.32.0 Rhdf5lib_1.28.0
[33] BiocParallel_1.40.0 jpeg_0.1-10
[35] parallel_4.4.2 cluster_2.1.6
[37] R6_2.5.1 RColorBrewer_1.1-3
[39] stringi_1.8.4 GenomicRanges_1.58.0
[41] SummarizedExperiment_1.36.0 iterators_1.0.14
[43] IRanges_2.40.0 Matrix_1.7-1
[45] splines_4.4.2 igraph_2.1.1
[47] tidyselect_1.2.1 rstudioapi_0.17.1
[49] abind_1.4-8 yaml_2.3.10
[51] codetools_0.2-20 hwriter_1.3.2.1
[53] processx_3.8.4 tibble_3.2.1
[55] plyr_1.8.9 Biobase_2.66.0
[57] withr_3.0.2 ShortRead_1.64.0
[59] evaluate_1.0.1 survival_3.7-0
[61] RcppParallel_5.1.9 Biostrings_2.74.0
[63] pillar_1.9.0 BiocManager_1.30.25
[65] MatrixGenerics_1.18.0 renv_1.0.11
[67] foreach_1.5.2 stats4_4.4.2
[69] generics_0.1.3 rprojroot_2.0.4
[71] S4Vectors_0.44.0 munsell_0.5.1
[73] scales_1.3.0 base64url_1.4
[75] glue_1.8.0 tools_4.4.2
[77] interp_1.1-6 data.table_1.16.2
[79] GenomicAlignments_1.42.0 rhdf5_2.50.0
[81] grid_4.4.2 ape_5.8
[83] latticeExtra_0.6-30 colorspace_2.1-1
[85] nlme_3.1-166 GenomeInfoDbData_1.2.13
[87] cli_3.6.3 fansi_1.0.6
[89] S4Arrays_1.6.0 gtable_0.3.6
[91] digest_0.6.37 BiocGenerics_0.52.0
[93] SparseArray_1.6.0 htmlwidgets_1.6.4
[95] htmltools_0.5.8.1 multtest_2.62.0
[97] lifecycle_1.0.4 here_1.0.1
[99] httr_1.4.7 secretbase_1.0.3
[101] MASS_7.3-61